package Control;

import Entity.MsgPackage;
import Entity.ReqForm;
import GUI.OutPutRequest_GUI;
import GUI.ScreenManager;

public class OutPutConrol {

	private OutPutRequest_GUI outPutReq_Gui;
	private MsgPackage outPutMSG;
	private ReqForm form;
	
	public OutPutConrol(){
		outPutReq_Gui = new OutPutRequest_GUI();
		outPutMSG = new MsgPackage();
		form = new ReqForm();
	}
	
	
	public void setReq(Integer reqNum){
		outPutMSG.setObject(reqNum);
		outPutMSG.setOp_code(OP_CODE.OUT_PUT_REQ);
		ScreenManager.getConnection().accept(outPutMSG);
		
		//while(ScreenManager.getConnection().getAnswerReceivedFlag() == false);	//wait until flag is changed and shows that result was received from server
		Object o = ScreenManager.getConnection().cclient.getMessage();

		//Object o = ScreenManager.getConnection().getResultobject();
		form = (ReqForm)o;
		outPutReq_Gui.getInfoSys().setText(form.getIn_system());
		outPutReq_Gui.getArgu().setText(form.getArgument());
		outPutReq_Gui.getComm().setText(form.getComments());
		outPutReq_Gui.getCurStatus().setText(form.getCurrent_status());
		outPutReq_Gui.getChaDes().setText(form.getChange_request());
		
		
		
		
		
	}


	public OutPutRequest_GUI getOutPutReq_Gui() {
		return outPutReq_Gui;
	}


	public ReqForm getForm() {
		return form;
	}
	
}
